Skip to content

Foreign ctest: portable suite against wheels and install prefixes - #3829

Open
nrnhines wants to merge 13 commits into
masterfrom
hines-grok/ctest-wheels
Open

Foreign ctest: portable suite against wheels and install prefixes#3829
nrnhines wants to merge 13 commits into
masterfrom
hines-grok/ctest-wheels

Conversation

@nrnhines

@nrnhines nrnhines commented Aug 2, 2026

Copy link
Copy Markdown
Member

Summary

Adds a standalone foreign CTest harness (test/foreign) so the portable part of the NEURON suite can run against an already installed NEURON (PyPI wheel or classic CMAKE_INSTALL_PREFIX) without rebuilding libnrniv.

  • Discovery from a chosen Python + optional install root (nrniv / nrnivmodl, features via neuron.config.arguments).
  • Version policy: hard match by default (git SHA / describe); local -DNRN_FOREIGN_ALLOW_SKEW=ON; CI-style hard fail with -DNRN_FOREIGN_CI=ON.
  • Serial suite (-L serial): smoke, pytest/datahandle/cover, hoctests, example_nmodl, ringtest, rxd, serial gj, etc.
  • MPI / CoreNEURON when the install supports them and mpiexec is available (-L mpi, -L coreneuron).
  • test-install target: builds mechanisms, runs default serial check, prints how to re-run full ctest.
  • Main build integration (NRN_ENABLE_TESTS=ON): ninja install && ninja test-install configures foreign into ${CMAKE_BINARY_DIR}/build-ctest against CMAKE_INSTALL_PREFIX (inherits CMake generator, e.g. Ninja).
  • Docs: NRN_ENABLE_TESTS, wheel testing, install instructions, developer index; detail in test/foreign/README.md and INVENTORY.md.

Usage sketch

# Wheel
pip install neuron-nightly pytest
cmake -S test/foreign -B build-ctest \
  -DNRN_FOREIGN_PYTHON="$(which python)" -DNRN_FOREIGN_ALLOW_SKEW=ON
cmake --build build-ctest --target test-install

# Prefix (from main build with -DNRN_ENABLE_TESTS=ON)
ninja install && ninja test-install
ctest --test-dir build-ctest -L mpi --output-on-failure

Test plan

  • Foreign suite vs neuron-nightly venv (serial + MPI + CoreNEURON labels during development)
  • Prefix path: NRN_ENABLE_TESTS=ON, ninja install, ninja test-install (PYTHONPATH to install/lib/python)
  • format-pr / cmake-format on touched CMake and Python
  • CI on this PR (Azure / GitHub as usual)
  • Optional: spot-check hoctests::test_neurondemo_py under prefix (known noisy stderr from lazy demo nrnivmodl)

nrnhines added 11 commits July 31, 2026 18:21
Record approved design for a separate test-only CMake project that runs
integration tests against a pip-installed NEURON wheel (neuron-nightly).
Add standalone test/foreign CMake project that probes a pip-installed
NEURON wheel, enforces version policy D, and runs serial smoke tests
(import, nrniv, neuron.test) without building libnrniv.
Parameterize NeuronTestHelper for foreign/wheel installs (source root,
nrnivmodl path, no libnrniv depends). Register test/pytest via wheel
nrnivmodl and wire target foreign to build special + test scripts.
Register smoke, pytest, datahandle, cover, unit, example_nmodl, hoctests,
ringtest, connect_dend, rxd, and serial gjtests against a wheel install.
Document local neuron-nightly workflow (metric C); label tests for -L serial.
Register mpiexec-backed parallel tests and CoreNEURON CPU (plus CN+MPI)
groups when the foreign wheel and host tools support them. Label suites
for ctest -L mpi / -L coreneuron; skip cleanly without mpiexec.
Document foreign-ok vs build-only tests; refine git-SHA matching for
nightlies; defend missing config keys; optional NRN_FOREIGN_ROOT prefix
PATH; configure-time test counts. No Azure job (out of scope).
cmake-format / coding-conventions format-pr output required for CI.
Convenience target builds mechanisms (foreign), runs ctest -L serial by
default, and always prints how to re-run ctest with full filter control.
NRN_ENABLE_TESTS=ON now adds ninja test-install, which configures
test/foreign into build/build-ctest against CMAKE_INSTALL_PREFIX after
install. Improve prefix discovery via lib/python on PYTHONPATH.
MPI env rebuild had dropped install lib/python from PYTHONPATH (all Python
foreign tests failed). Force-cache site PYTHONPATH on reconfigure. Pass
-G CMAKE_GENERATOR so test-install inherits the generator (e.g. Ninja)
from the main build.
Expand NRN_ENABLE_TESTS (in-tree vs test-install), wheel testing via
test/foreign, and cross-links from install instructions, developer
index, coverage, and GPU testing pages.
@codecov

codecov Bot commented Aug 2, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 68.53%. Comparing base (dc3ebb2) to head (c7660eb).

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #3829      +/-   ##
==========================================
+ Coverage   68.52%   68.53%   +0.01%     
==========================================
  Files         695      695              
  Lines      111595   111595              
==========================================
+ Hits        76465    76480      +15     
+ Misses      35130    35115      -15     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@github-actions

github-actions Bot commented Aug 2, 2026

Copy link
Copy Markdown
Contributor

✔️ b7b9829 -> artifacts URL

@sonarqubecloud

sonarqubecloud Bot commented Aug 4, 2026

Copy link
Copy Markdown

@azure-pipelines

Copy link
Copy Markdown

✔️ c7660eb -> Azure artifacts URL

@github-actions

github-actions Bot commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

✔️ c7660eb -> artifacts URL

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant